<?php
class PizzaSingle {
    private static $instance = null;
    //防止被外部new
    private function __construct()
    {
    }
    //防止被复制
    private function __clone()
    {
        // TODO: Implement __clone() method.
    }
    //只能通过该方法获取new
    public static function getInstance() {
        //是否已经new对象
        if (empty(self::$instance))
        {
            //没创建，则new自己
           self::$instance = new self();
        }
        return self::$instance;
    }

    public function say() {
        echo 'hello, i am pizza';
    }
}